1. Field of the Invention
The present invention relates to a control system and method for rewriting data in a flash memory storing both a boot program and a main program as firmware of an electronic device and to a data storage medium in which a program is stored for rewriting data in a flash memory.
2. Description of Related Art
The boot program and the main program of the firmware in printers, scanners, and other such electronic devices are separate programs typically stored in flash memory. In a printer, for example, the main program controlling the normal operation of the printer, i.e., the printing process, and font data are stored in a main memory portion of the flash memory. The program for running the boot program to initialize the printer, and a program for controlling a memory rewrite process for writing to the flash memory are stored in a boot memory portion of the flash memory. The rewrite process is used to rewrite to the main program and/or rewrite font data in the main memory portion. The main memory portion and the boot memory portion are each composed of one or more sectors. A “sector” as the term is used herein means a unit of batch-erasable memory of the flash memory device.
In the conventional rewrite process, rewriting data stored in the boot memory portion (i.e., the boot data) requires three download operations because the programs stored in a boot sector prohibit rewriting in the boot memory portion.
FIG. 12 shows the movement of data with this conventional rewrite process. The rewrite process for flash memory sectors other than the boot memory portion is run by the boot data stored in the boot memory portion, and the boot data is rewritten with newly downloaded boot block rewrite data.
The boot block rewrite data is acquired in a first download process by the boot data, the data stored in the main memory portion (the main data) is erased, and the acquired boot block rewrite data is written to the main memory portion (I in FIG. 12).
The new boot data is then acquired by the boot block rewrite data in a second download step, the boot memory portion is erased, and the new boot data is written to the boot memory portion (II in FIG. 12).
New main data, if any, is then acquired in a third download step by the new boot data, the boot block rewrite data is erased from the main memory portion, and the acquired new main data is then written to the main memory portion (FIG. 12, III). If it is not necessary to update the main data, the old main data (the data that was erased in the first step) is acquired again in the third download step and written to the main memory portion.
As described above, rewriting data stored in the boot memory portion of the flash memory cannot be completed without three download operations. The rewrite process is therefore complicated, error-prone, and time-consuming.